package com.dynamixsoftware.printershare.snmp;

import java.util.Vector;

public class SNMPMessage
  extends SNMPSequence
{
  public SNMPMessage(int paramInt, String paramString, SNMPPDU paramSNMPPDU)
  {
    Vector localVector = new Vector();
    localVector.insertElementAt(new SNMPInteger(paramInt), 0);
    localVector.insertElementAt(new SNMPOctetString(paramString), 1);
    localVector.insertElementAt(paramSNMPPDU, 2);
    try
    {
      setValue(localVector);
      return;
    }
    catch (SNMPBadValueException localSNMPBadValueException) {}
  }
  
  public SNMPMessage(byte[] paramArrayOfByte)
    throws SNMPBadValueException
  {
    super(paramArrayOfByte);
    Vector localVector = (Vector)getValue();
    if (localVector.size() != 3) {
      throw new SNMPBadValueException("Bad SNMP message");
    }
    if (!(localVector.elementAt(0) instanceof SNMPInteger)) {
      throw new SNMPBadValueException("Bad SNMP message: bad version");
    }
    if (!(localVector.elementAt(1) instanceof SNMPOctetString)) {
      throw new SNMPBadValueException("Bad SNMP message: bad community name");
    }
    if (!(localVector.elementAt(2) instanceof SNMPPDU)) {
      throw new SNMPBadValueException("Bad SNMP message: bad PDU");
    }
  }
  
  public String getCommunityName()
    throws SNMPBadValueException
  {
    Object localObject = ((Vector)getValue()).elementAt(1);
    if (!(localObject instanceof SNMPOctetString)) {
      throw new SNMPBadValueException("Wrong SNMP type for community name in message: expected SNMPOctetString, have " + localObject.getClass().toString());
    }
    return ((SNMPOctetString)localObject).toString();
  }
  
  public SNMPPDU getPDU()
    throws SNMPBadValueException
  {
    Object localObject = ((Vector)getValue()).elementAt(2);
    if (!(localObject instanceof SNMPPDU)) {
      throw new SNMPBadValueException("Wrong PDU type in message: expected SNMPPDU, have " + localObject.getClass().toString());
    }
    return (SNMPPDU)localObject;
  }
  
  public Object getPDUAsObject()
    throws SNMPBadValueException
  {
    return ((Vector)getValue()).elementAt(2);
  }
}


/* Location:           C:\Users\Admin\Desktop\Decompiler\JAD\jd-gui-0.3.6.windows\classes_dex2jar.jar
 * Qualified Name:     com.dynamixsoftware.printershare.snmp.SNMPMessage
 * JD-Core Version:    0.7.0.1
 */